package com.polaris.live.dialog

import android.content.Context
import com.lxj.xpopup.core.CenterPopupView
import com.polaris.live.R
import com.polaris.live.common.ext.setOnSingleClickListener
import com.polaris.live.databinding.DialogStartLiveLevelNotBinding
import com.polaris.live.ui.me.RichCharmActivity
import com.polaris.live.utils.route.RoutePath
import com.polaris.live.utils.route.Router

/**
 * StartLiveLevelNotDialog      等级不足弹窗
 *
 * @author Created by 半仙 on 2023/10/21/021 11:43
 */
class StartLiveLevelNotDialog(
    context: Context,
    private val message: String,
    private val confirm: String? = null,
    private val richOrCharm: Int = 0,//外界只需要传0或1就行   0就是壕等级,1就是魅等级
) :
    CenterPopupView(context) {
    override fun getImplLayoutId(): Int {
        return R.layout.dialog_start_live_level_not
    }

    private lateinit var mBinding: DialogStartLiveLevelNotBinding

    override fun onCreate() {
        super.onCreate()
        mBinding = DialogStartLiveLevelNotBinding.bind(popupImplView)
        mBinding.icClose.setOnSingleClickListener {
            dismiss()
        }
        mBinding.message.text = message
        mBinding.updataMessage.setOnSingleClickListener {
            Router.builder(RoutePath.RICH_CHARM_ACTIVITY)
                .withInt(RichCharmActivity.PAGE, richOrCharm).navigation()
            dismiss()
        }

        if (confirm != null) {
            mBinding.updataMessage.text = confirm
        }
    }
}